package com.chenfan.process.enums;

import lombok.Getter;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @author K
 * @date 2021/3/9
 * 执行的通知类型
 */
@Getter
public enum ProcessNotifyTypeEnums {
    /**
     * 钉钉
     */
    DING_DING(1, "钉钉"),
    /**
     * 钉钉
     */
    URL(2, "网络"),
    /**
     * MQ
     */
    MQ(3, "MQ");
    private static final Map<Integer, ProcessNotifyTypeEnums> MAPPINGS;

    static {
        Map<Integer, ProcessNotifyTypeEnums> temp = new HashMap<>();
        for (ProcessNotifyTypeEnums mode : values()) {
            temp.put(mode.index, mode);
        }
        MAPPINGS = Collections.unmodifiableMap(temp);
    }

    private final Integer index;
    private final String name;

    ProcessNotifyTypeEnums(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public static ProcessNotifyTypeEnums resolve(int index) {
        return MAPPINGS.get(index);
    }
}
